django override help text

101

django override help text -

# Admin.py file
from django.contrib import admin
from django.forms import ModelForm

class MyForm(forms.ModelForm): # Create custom form class
    def __init__(self, *args, **kwargs):
        super(MyForm, self).__init__(*args, **kwargs)
        self.fields['myfield'].help_text = 'New help text!'

class MyModel(admin.ModelAdmin): # Include it in your existing form 
     # ...
     form = MyForm

Comments

Submit
0 Comments